﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="SuppProducts.aspx.cs" Inherits="Companies_Products" Title="Продукти на Доставчици" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        &nbsp;</p>
    <p>
    &nbsp;<table class="style1">
            <tr>
                <td>
    СПИСЪК НА ПРОДУКТИТЕ
        НА ДОСТАВЧИК:</td>
                <td>
                    Виж продуктите на друг Доставчик:</td>
            </tr>
            <tr>
                <td>
    <asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="sdsSuppliers" 
        DataTextField="Name" DataValueField="SupplierID" Font-Bold="True" 
        ForeColor="#993300" Font-Size="Large">
    </asp:BulletedList>
                </td>
                <td>
                    <asp:DropDownList ID="ddlAllSuppliers" runat="server" AutoPostBack="True" 
                        DataSourceID="sdsAllSuppliers" DataTextField="Name" DataValueField="SupplierID" 
                        onselectedindexchanged="ddlAllSuppliers_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </p>
    <p>
        <asp:GridView ID="gvItems" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ItemID" DataSourceID="sdsItems" BackColor="White" 
            BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
            ForeColor="Black" GridLines="Vertical">
            <FooterStyle BackColor="#CCCC99" />
            <RowStyle BackColor="#F7F7DE" />
            <Columns>
                <asp:BoundField DataField="ItemCode" HeaderText="Код" 
                    SortExpression="ItemCode" />
                <asp:BoundField DataField="NameBG" HeaderText="Име БГ" 
                    SortExpression="NameBG" />
                <asp:BoundField DataField="NameEN" HeaderText="Име АН" 
                    SortExpression="NameEN" />
                <asp:BoundField DataField="Name" HeaderText="Клиент" SortExpression="Name" />
                <asp:BoundField DataField="EXW1" HeaderText="EXW в ЛВ без обков" 
                    SortExpression="EXW1" />
                <asp:BoundField DataField="EXW2" HeaderText="EXW цена на  обкова в ЛВ" 
                    SortExpression="EXW2" />
                <asp:BoundField DataField="EXW3" HeaderText="EXW цена в ЛВ с обков" 
                    SortExpression="EXW3" />
              <asp:BoundField DataField="Count1" HeaderText="Бр. в Комплект" 
                    SortExpression="Count1" />
                <asp:BoundField DataField="Count2" HeaderText="Комплект в Кашон" 
                    SortExpression="Count2" />
                <asp:BoundField DataField="Count3" HeaderText="Кашони в Палет" 
                    SortExpression="Count3" />
                <asp:BoundField DataField="Count4" HeaderText="Комплекти в палет" 
                    SortExpression="Count4" />
            </Columns>
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="sdsItems" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
            OldValuesParameterFormatString="original_{0}" 
            
            SelectCommand="SELECT Items.ItemID, Items.ItemCode, Items.NameBG, Items.NameEN, Items.CustomerID, Items.SupplierID, Items.EXW1, Items.EXW2, Items.EXW3,Items.DDU1_EUR, Items.DDU2_EUR, Items.DDUEUR, Items.DDUBGN, Customers.Name, Suppliers.Name AS Expr1, Items.Count1, Items.Count2, Items.Count3, Items.Count4 FROM Items INNER JOIN Customers ON Items.CustomerID = Customers.CustomerID INNER JOIN Suppliers ON Items.SupplierID = Suppliers.SupplierID WHERE (Items.SupplierID = @SupplierID)">
            <SelectParameters>
                <asp:QueryStringParameter Name="SupplierID" QueryStringField="SupplierID" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <asp:SqlDataSource ID="sdsAllSuppliers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
        SelectCommand="SELECT [SupplierID], [Name] FROM [Suppliers]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sdsSuppliers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
        SelectCommand="SELECT [SupplierID], [Name] FROM [Suppliers] WHERE ([SupplierID] = @SupplierID)">
        <SelectParameters>
            <asp:QueryStringParameter Name="SupplierID" QueryStringField="SupplierID" 
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <p>
        <asp:Button ID="btnAddProduct" runat="server" onclick="btnAddProduct_Click" 
            Text="Добави Нов Продукт" />
        &nbsp;<asp:Button ID="btnEdit" runat="server" Text="Редактиране на Продукт" 
            onclick="btnEdit_Click" />
        &nbsp;<asp:Button ID="bntDel" runat="server" Text="Изтриване на Продукт" 
            onclick="bntDel_Click" />
    </p>
    </asp:Content>

